/**
 * Luu vao cookie: de biet dc la trong man hinh nao dang xem o lesson nao
 * 
 * @param tblName :
 *            ten field (vd: tai man hinh reading dang coi o lesson 5)
 * @param value :
 *            gia tri (id cua lesson)
 * @param expires
 *            Define lifetime of the cookie. Value can be a Number (which will
 *            be interpreted as days from time of creation) or a Date object. If
 *            omitted, the cookie is a session cookie.
 * @param path :
 *            Define the path where cookie is valid. By default the path of the
 *            cookie is the path of the page where the cookie was created
 *            (standard browser behavior). If you want to make it available for
 *            instance across the entire page use path: '/'.
 * @param domain :
 *            Domain of page where the cookie was created.
 * @param secure :
 *            Default: false. If true, the cookie transmission requires a secure
 *            protocol (https).
 * @param raw
 *            :By default the cookie is encoded/decoded when creating/reading,
 *            using encodeURIComponent/ decodeURIComponent. Turn off by setting
 *            raw: true.
 */

function test() {
	alert('msg tu function test cua cookie.js');
}

function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires=" + date.toGMTString();
	} else
		var expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for (var i = 0; i < ca.length; i++) {
		var c = ca[i];
		while (c.charAt(0) == ' ')
			c = c.substring(1, c.length);
		if (c.indexOf(nameEQ) == 0)
			return c.substring(nameEQ.length, c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name, "", -1);
}

/*
 * //To set a cookie function set(name, value){ $.cookie(name, value); }
 * 
 * //Create expiring cookie, 7 days from then: function
 * create(name,value,expieres){ $.cookie(name, value, { expires: expieres }); }
 * 
 * //Create expiring cookie, valid across entire page: function
 * create(name,value,expieres,path){ $.cookie(name,value, { expires: expieres,
 * path: path }); }
 * 
 * //Read cookie function get(name){ $.cookie(name); // => 'the_value' }
 * 
 * //Delete cookie by passing null as value: function delete(name){
 * $.cookie(name,null); // => 'the_value' }
 * 
 * //Creating cookie with all availabl options function
 * create(name,value,expieres,path,domain,secure,raw){ $.cookie(name,value, {
 * expires: expieres, path: path , domain : domain, secure : secure,raw : raw
 * }); }
 */